Skip to content

Disable native addon loading on native edge binaries (WASIX parity) - #113

Closed
Arshia001 wants to merge 1 commit into
mainfrom
fix/edge-native-disable-addons
Closed

Disable native addon loading on native edge binaries (WASIX parity)#113
Arshia001 wants to merge 1 commit into
mainfrom
fix/edge-native-disable-addons

Conversation

@Arshia001

Copy link
Copy Markdown
Member

Split out of #111.

Native and WASIX edge binaries must expose the same functionality. WASIX cannot load native addons, so the native binaries now refuse them too: process.dlopen throws a catchable ERR_DLOPEN_FAILED before any real dlopen happens. The early catchable throw is load-bearing — packages with optional native accelerators (bcrypt, sqlite3, etc.) hit their JS fallback path identically on both targets.

🤖 Generated with Claude Code

Native and WASIX must expose the exact same functionality, and WASIX has
no dynamic linking — so process.dlopen now throws a catchable
ERR_DLOPEN_FAILED before ever calling dlopen(), on every target. Failing
early is load-bearing: legacy NAPI_MODULE-style prebuilds (bufferutil,
utf-8-validate, most node-gyp-build prebuilds) call the unexported
napi_module_register symbol from a static constructor *during* dlopen,
which previously killed the whole process with an uncatchable dynamic
linker error. With the early throw, optional native accelerators fall
back to their pure-JS implementations exactly as they do under WASIX.

The now-unreachable dlopen machinery (library cache, initializer lookup,
open/close helpers) is removed. N-API support itself is unaffected:
native napi tests are statically linked, and safe mode / WASIX load
addons through the wasmer napi extension.

Verified: process.dlopen throws catchably on both the QuickJS and V8
native binaries; bufferutil resolves to its JS fallback; js-hedgedoc
passes Node/native/WASIX and js-totaljs-cms native unchanged.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Arshia001

Copy link
Copy Markdown
Member Author

Since the aim is to eventually enable dynamic module loading on WASIX as well, this change doesn't make a lot of sense.

@Arshia001 Arshia001 closed this Jul 17, 2026
Arshia001 added a commit that referenced this pull request Jul 20, 2026
PRs #113 (disable native addon loading) and #114 (process.platform='linux'
under WASIX) were closed without merging, so this branch no longer carries
them. Two apps depended on that behavior, each on one stage only:

* js-hedgedoc on native — its optional ws accelerators bufferutil and
  utf-8-validate ship legacy NAPI_MODULE prebuilds that call the unexported
  napi_module_register from a static constructor during dlopen, killing the
  process (exit 127) before any JS runs. #113's early catchable throw is what
  made this fall back to the pure-JS path. Passes on WASIX (no dlopen).
* js-uptime-kuma on WASIX — playwright-core's registry throws
  `Unsupported platform: wasi` at require time. Passes on native.

js-remix-staticsite is unskipped again on WASIX: it was only skipped because
#114 made `arch` take its execSync path, and it passes now (verified 1/1).

Verified locally: native 17 pass / WASIX 16 pass, with the pre-existing local
js-etherpad environment failure (pnpm-in-app + oidc-provider ttl; green in CI)
the only remainder.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant